
/*
 * @(#)ChristofidesWrapper.java 1.0 05/12/13
 *
 * Clase Compartida
 * PROP Grupo 13 Cluster 3
 */

package dominio;

import Crist.Christofides;

import java.util.ArrayList;

/**
 * Created by Rafael Simon Garcia on 12/5/13.
 */
public class ChristofidesWrapper extends OptimizationAlgorithm{

    public static PathOptimizationResult GetPathOptimizationResult(Graph g){
        Integer [] tmpresult;

        ArrayList<Integer> newPathPositions = new ArrayList<>(g.GetNumberNodes());
        Christofides algorithm = new Christofides(false);

        nodesList = g.GetList();

        tmpresult= algorithm.solve(g);

        for(int i: tmpresult) newPathPositions.add(i);

        return new PathOptimizationResult(null, RearrangeNodesFromTour(newPathPositions));
    }
}
